package com.pan.kang.frame.controller;


import com.pan.kang.frame.context.IStoreProcedureQueryContext;
import com.pan.kang.frame.model.StoreProcedureResult;
import com.pan.kang.frame.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/procedure")
public class ProcedureController {

    @Autowired
    private IStoreProcedureQueryContext storeProcedureQueryContext;

    @PostMapping(path = "/findList")
    public StoreProcedureResult<UserVo> findList(@RequestBody(required = true) final Map<String, Object> mapIn) {
        String procedureName = "user_procedure";
        Map<String, Object> mapOut = new HashMap<String, Object>();
        mapOut.put("o_nickname", java.sql.Types.VARCHAR);
        mapOut.put("o_mobile", java.sql.Types.VARCHAR);
        StoreProcedureResult<UserVo> storeProcedureResult =
                storeProcedureQueryContext.findListByStoreProcedure(procedureName, UserVo.class, mapIn, mapOut);
        return storeProcedureResult;
    }
}
